<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Coexisting Vue Microfrontends</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="importmap-type" content="systemjs-importmap">
    <script type="systemjs-importmap">
      {
        "imports": {
          "sample-vue": "http://localhost:8080/js/app.js",
          "single-spa": "https://cdnjs.cloudflare.com/ajax/libs/single-spa/4.4.1/system/single-spa.min.js",
          "sample-react": "http://localhost:9001/index.js",
          "sample-vue-parcel": "http://localhost:8081/js/app.js",
          "sample-react-parcel": "http://localhost:9002/index.js",
          "vue": "https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js",
          "vue-router": "https://cdn.jsdelivr.net/npm/vue-router@3.1.3/dist/vue-router.min.js",
          "react": "https://unpkg.com/react@16.12.0/umd/react.production.min.js",
          "react-dom": "https://unpkg.com/react-dom@16.12.0/umd/react-dom.production.min.js",
          "axios": "https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.0/axios.min.js"
        }
      }
    </script>
    <!-- PRELOADS -->
    <link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/single-spa/4.4.1/system/single-spa.min.js" as="script" crossorigin="anonymous" />
    <link rel="preload" href="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js" as="script" crossorigin="anonymous" />
    <link rel="preload" href="https://cdn.jsdelivr.net/npm/vue-router@3.1.3/dist/vue-router.min.js" as="script" crossorigin="anonymous" />
    <link rel="preload" href="https://unpkg.com/react@16.12.0/umd/react.production.min.js" as="script" crossorigin="anonymous" />
    <link rel="preload" href="https://unpkg.com/react-dom@16.12.0/umd/react-dom.production.min.js" as="script" crossorigin="anonymous" />
    <link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.0/axios.min.js" as="script" crossorigin="anonymous" />
    <!-- SCRIPTS -->
    <script src="https://unpkg.com/import-map-overrides@1.7.2/dist/import-map-overrides.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/6.1.1/system.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/6.1.1/extras/amd.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/6.1.1/extras/named-exports.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/6.1.1/extras/named-register.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/6.1.1/extras/use-default.js"></script>
  </head>
  <body>
    <script>
      Promise.all([System.import('single-spa'), System.import('vue'), System.import('vue-router'), 
      System.import('react'), System.import('react-dom'), System.import('axios')]).then(function (modules) {
        var singleSpa = modules[0];
        
        singleSpa.registerApplication(
          'sample-vue',
          () => System.import('sample-vue'),
          location => location.pathname.startsWith('/') || location.hash.startsWith('#/about')
        );
        singleSpa.registerApplication(
          'sample-react',
          () => System.import('sample-react'),
          location => location.hash.startsWith('#/react') || location.hash.startsWith('#/react_about')
        );
        singleSpa.start();
      })
    </script>
    <!-- See https://github.com/joeldenning/import-map-overrides#user-interface  -->
    <import-map-overrides-full show-when-local-storage="overrides-ui"></import-map-overrides-full>
  </body>
</html>